CREATE TABLE [dbo].[TTDOCP_ANUL]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[CO_PROV] [dbo].[TD_VC_020] NOT NULL,
[CO_TIPO_DOCU] [dbo].[TD_VC_003] NOT NULL,
[NU_DOCU_PROV] [dbo].[TD_VC_020] NOT NULL,
[CO_TIPO_OPER] [dbo].[TD_VC_003] NOT NULL,
[CO_MOTV_ANUL] [dbo].[TD_VC_003] NULL,
[FE_ANUL] [dbo].[TD_DT_001] NOT NULL,
[ST_CONT] [dbo].[TD_VC_001_INTE] NOT NULL CONSTRAINT [DF__TTDOCP_AN__ST_CO__4B6D135E] DEFAULT ('N'),
[NU_PROC] [dbo].[TD_IN_001] NOT NULL CONSTRAINT [DF__TTDOCP_AN__NU_PR__4D555BD0] DEFAULT ((0)),
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TTDOCP_AN__CO_US__4E498009] DEFAULT (suser_sname()),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTDOCP_AN__FE_US__4F3DA442] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TTDOCP_AN__CO_US__5031C87B] DEFAULT (suser_sname()),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTDOCP_AN__FE_US__5125ECB4] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTDOCP_ANUL] WITH NOCHECK ADD CONSTRAINT [CK__TTDOCP_AN__ST_CO__4C613797] CHECK NOT FOR REPLICATION (([ST_CONT]='P' OR [ST_CONT]='N'))
GO
ALTER TABLE [dbo].[TTDOCP_ANUL] ADD CONSTRAINT [PK__TTDOCP_A__3D80D1472BFF54FD] PRIMARY KEY CLUSTERED  ([CO_EMPR], [CO_PROV], [CO_TIPO_DOCU], [NU_DOCU_PROV]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTDOCP_ANUL] ADD CONSTRAINT [FK__TTDOCP_ANUL__564A9484] FOREIGN KEY ([CO_EMPR], [CO_MOTV_ANUL]) REFERENCES [dbo].[TTMOTV_ANUP] ([CO_EMPR], [CO_MOTV_ANUL])
GO
ALTER TABLE [dbo].[TTDOCP_ANUL] ADD CONSTRAINT [FK__TTDOCP_ANUL__573EB8BD] FOREIGN KEY ([CO_EMPR], [CO_PROV], [CO_TIPO_DOCU], [NU_DOCU_PROV]) REFERENCES [dbo].[TMDOCU_PROV] ([CO_EMPR], [CO_PROV], [CO_TIPO_DOCU], [NU_DOCU_PROV])
GO
ALTER TABLE [dbo].[TTDOCP_ANUL] ADD CONSTRAINT [FK__TTDOCP_ANUL__5832DCF6] FOREIGN KEY ([CO_EMPR], [CO_TIPO_OPER]) REFERENCES [dbo].[TTTIPO_OPER] ([CO_EMPR], [CO_TIPO_OPER])
GO
